package cn.donting.jme.expansion.attribute.lmpl;

import cn.donting.jme.expansion.attribute.Attribute;
import cn.donting.jme.expansion.attribute.ValueChangeListener;
import cn.donting.jme.swing.JFloatTextField;
import cn.donting.jme.swing.JVector4fTextField;
import com.jme3.math.Vector4f;
import lombok.extern.slf4j.Slf4j;
import org.jdesktop.swingx.VerticalLayout;

import javax.swing.*;
import java.awt.*;
import java.math.BigDecimal;

@Slf4j
public class Vector4fAttribute extends AbsMuiltLineAttribute<Vector4f, JVector4fTextField> implements ValueChangeListener<Vector4f> {


    public Vector4fAttribute(String title) {
        this();
        setTitle(title);
    }

    public Vector4fAttribute() {
        super(new JVector4fTextField());
        inputComponent.addValueChangeListener(this::change);
    }


    @Override
    public void setValue(Vector4f value) {
        inputComponent.setValue(value);
    }


    @Override
    public void change(Vector4f newValue) {
        valueChange(getValue());
    }

    @Override
    protected Vector4f getInputValue() {
        return inputComponent.getValue();
    }
}
